/*
 * MainFrame.h
 *
 *  Created on: 15 Nov 2013
 *      Author: axel
 */

#ifndef MAINFRAME_H_
#define MAINFRAME_H_

#include <GL/glew.h>
#include <glfw3.h>
#include <ctime>
#include "StateMachine.h"
#include "StateManager.h"
#include "LoadShader.h"


class MainFrame
{
public:
	static const int WIDTH;
	static const int HEIGHT;
	static const char* TITLE;

	MainFrame(void);
	~MainFrame(void);
	void gameLoop();

private:
	long lastFrame;
	bool running;
	GLFWwindow* window;

	static const double FPS;
	static int timer;

	StateMachine* currentState;
	StateManager* manager;

	long getTime();
	void destroy();
	void stopLoop();

	void update();
	void render(float interpolation);
	void handleInput();
	void changeState(StateMachine* level);

	static void VSyncOff();
	static void VSyncOn();

	void init();
	void initWithGLFW();
	void initGlew();

};


#endif /* MAINFRAME_H_ */
